<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <div class="dashboard-text" v-permission="['admin']">name: admin</div>
    <div class="dashboard-text" v-permission="['editor']">name: editor</div>

    <div class="dashboard-text" v-if="checkPermission(['admin'])">
<div> name: admin 2</div>

    </div>
    <div class="dashboard-text" v-if="checkPermission(['editor'])">

<div> name: editor 2</div>

    </div>

 
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import permission from "@/directive/permission/index.js"; // 权限判断指令
import checkPermission from "@/utils/permission"; // 权限判断函数

export default {
  name: "Dashboard",
  computed: {
    ...mapGetters(["name"]),
  },
  directives: { permission },
  methods: {
    checkPermission
  },
};
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
